<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title> 腾书房 | 以书交友,以书会友 </title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="alternate icon" type="image/png" href="${base}/img/favicon.png">
    <link rel="stylesheet" href="${base}/css/amazeui.min.css"/>
    <link rel="stylesheet" href="${base}/css/site.css"/>

</head>
<body>
<header class="am-topbar">
    <h1 class="am-topbar-brand">
        <a href="${base}/">腾书房</a>
    </h1>

    <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only"
            data-am-collapse="{target: '#doc-topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span
            class="am-icon-bars"></span></button>

    <div class="am-collapse am-topbar-collapse" id="doc-topbar-collapse">
        <ul class="am-nav am-nav-pills am-topbar-nav">
            <li><a href="${base}/">首页</a></li>
            <li><a href="${base}/user/myInfo">我的主页</a></li>
            <li><a href="${base}/addBook">我有旧书</a></li>
            <li class="am-dropdown" data-am-dropdown>
                <a class="am-dropdown-toggle" data-am-dropdown-toggle href="javascript:;">
                    分类 <span class="am-icon-caret-down"></span>
                </a>
                <ul class="am-dropdown-content">
                    <%for(cate in session.category){%>
                    <li><a href="${base}/book/listBook?category=${cate.id}">${cate.name}</a></li>
                    <%}%>
                </ul>
            </li>
        </ul>

        <%if(session.user!=null){%>
        <div class="am-topbar-right">
            <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list">
                <li class="am-dropdown" data-am-dropdown>
                    <a class="am-dropdown-toggle" data-am-dropdown-toggle href="javascript:;">
                        <span class="am-icon-users"></span> ${session.user.name} <span class="am-icon-caret-down"></span>
                    </a>
                    <ul class="am-dropdown-content">
                        <li><a href="${base}/user/myInfo"><span class="am-icon-user"></span> 资料</a></li>
                        <li><a href="${base}/user/logout"><span class="am-icon-power-off"></span> 退出</a></li>
                    </ul>
                </li>
            </ul>
        </div>
        <%}else{%>

        <div class="am-topbar-right">
            <button onclick="window.location='${base}/register'" class="am-btn am-btn-success am-topbar-btn am-btn-sm">
                注册
            </button>
            <button onclick="window.location='${base}/login'" class="am-btn am-btn-primary am-topbar-btn am-btn-sm">登录
            </button>
        </div>

        <%}%>

        <form class="am-topbar-form am-topbar-left am-form-inline am-topbar-right" role="search">
            <div class="am-form-group">
                <input type="text" class="am-form-field am-input-sm" placeholder="搜索文章">
            </div>
            <button type="submit" class="am-btn am-btn-default am-btn-sm">搜索</button>
        </form>

    </div>
</header>

${layoutContent}

<footer class="blog-footer">
    <p>腾书房<br/>
        <small>© Copyright by the WhiteBlue.</small>
    </p>
    <a href="http://abc.whiteblue.xyz/wordpress">My Blog</a>
</footer>

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="${base}/js/polyfill/rem.min.js"></script>
<script src="${base}/js/polyfill/respond.min.js"></script>
<script src="${base}/js/amazeui.legacy.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="${base}/js/jquery.min.js"></script>
<script src="${base}/js/amazeui.min.js"></script>
<script src="${base}/js/site.js"></script>
<!--<![endif]-->

</body>
</html>
